<template>
  <div class="ag-grid-action">
    <el-button type="text" @click="handleAdd">{{$t('common.add')}}</el-button>
    <el-button type="text" v-show="showDelBtn" @click="handleDel">{{$t("common.delete")}}</el-button>
  </div>
</template>

<script>
export default {
  name: "ActionRender",
  mounted() {},
  computed:{
    showDelBtn(){
      const list = this.params.context.componentParent.data;
      return list.length > 1
    }
  },
  methods: {
    handleAdd() {
      this.params.context.componentParent.actionEvent(this.params.rowIndex + 1,'add')
    },
    handleDel(){
      console.log(this.params,'params');
      this.params.context.componentParent.actionEvent(this.params.rowIndex,'delete')
    }   
  },
};
</script>

<style></style>
